﻿using System.Collections.Generic;
using System.Web.Mvc;
using ServicioWebRest.Areas.Api.Models;

namespace ServicioWebRest.Areas.Api.Controllers
{
    public class ClientesController : Controller
    {
        private ClienteManager clientesManager;

        public ClientesController()
        {
            clientesManager = new ClienteManager();
        }

        // GET /Api/Clientes
        [HttpGet]
        public JsonResult Clientes(string usu)
        {
            switch (Request.HttpMethod)
            {

                case "GET":
                    return Json(clientesManager.ObtenerClientes(usu), JsonRequestBehavior.AllowGet);
            }
            return Json(new { Error = true, Message = "Operación HTTP desconocida" });
        }
        static string GetStringValue()
        {
            return null;
        }

        public JsonResult Cliente(int? id, string usu, Cliente item)
        {
            switch (Request.HttpMethod)
            {

                case "GET":
                    return Json(clientesManager.ObtenerCliente(usu),JsonRequestBehavior.AllowGet); 
            }

            return Json(new { Error = true, Message = "Operación HTTP desconocida" });
        }


        public JsonResult SuperClientes(string usu, string ind, string f_i, string f_f)
        {
            switch (Request.HttpMethod)
            {

                case "GET":
                    return Json(clientesManager.ObtenerSuperClientes(usu, ind,f_i,f_f), JsonRequestBehavior.AllowGet);
            }

            return Json(new { Error = true, Message = "Operación HTTP desconocida" });
        }
    }
}
